package main

import (
	"fmt"
	"sync"
)

func main() {
	solution1("12AB34Y")
	solution()
}

func solution1(str string) {
	var wg sync.WaitGroup
	wg.Add(2)
	ch := make(chan struct{})
	go func() {
		defer wg.Done()
		for i := 0; i < len(str); i++ {
			ch <- struct{}{}
			if str[i] >= '0' && str[i] <= '9' {
				fmt.Println("打印数字:", string(str[i]))
			}
		}
	}()

	go func() {
		defer wg.Done()
		for i := 0; i < len(str); i++ {
			<-ch
			if !(str[i] >= '0' && str[i] <= '9') {
				fmt.Println("打印字母:", string(str[i]))
			}
		}
	}()
	wg.Wait()
}

func solution() {
	for {
		go func() {
			select {}
		}()
	}
}
